//
//  ZyaPaySegVC.swift
//  SlaughterClient
//
//  Created by 邱仙凯 on 2021/3/18.
//  Copyright © 2021 zwb. All rights reserved.
//

import UIKit
 
class ZyaPaySegVC: KSSegmenteController {

   
    lazy var addItem:UIBarButtonItem = {
        let addItem = UIBarButtonItem(barButtonSystemItem: .add, target: self, action: #selector(add))
        return addItem
    }()
  
    override func viewDidLoad() {
        super.viewDidLoad()
        title = "付款管理"
       
  
        // Do any additional setup after loading the view.
    }
    override func ksSegmenteControllerMoveTo(index: Int) {
        if index == 0 {
             
        } else if index == 1 {
            
        } else {
            
        }
        setItem(index: index)
    }
    
    func setItem(index:Int) {
        navigationItem.rightBarButtonItem = index == 0 ? nil : addItem
    }


    
    @objc func add() {
        let vc = ZyaPayFormVC()
        vc.refreshClosure = {
          let viewC = self.vcs[1] as! ZyaPayListVC
            viewC.tableView.mj_header?.beginRefreshing()
        }
        self.navigationController?.pushViewController(vc, animated: true)
    }
   
}
